package com.xx.dao;

import com.xx.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

public interface UserDao {
    List<User> getUserList();

    // sql分页
    List<User> getUserList2(Map<String, Object> map);

    @Select("select * from user")
    List<User> getUserList3();

    // RowBounds分页
    List<User> getUserListByRowBounds();

    User getUserById();

    boolean addUser(User user);

    boolean addUser2(Map<String, Object> map);

    @Insert("insert into user(id, name, pwd) values(#{id}, #{name}, #{pwd})")
    boolean addUser3(User user);

    boolean deleteUser(int id);

    // @Param()，给参数起别名
    @Delete("delete from user where id = #{userId}")
    boolean deleteUser2(@Param("userId") int id);

    int updateUser(User user);

    @Update("update user set name = #{name}, pwd = #{pwd} where id = #{id}")
    int updateUser2(User user);
}
